import {NgModule} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import {LoginGuardGuard} from "./router-guards/login-guard.guard";
import {WelcomeComponent} from "./pages/welcome/welcome.component";
import {GrantGuardGuard} from "./router-guards/grant-guard.guard";
import {NotFoundPageComponent} from "./pages/others/not-found-page/not-found-page.component";

const routes: Routes = [
  {path: '', pathMatch: 'full', redirectTo: '/welcome'},
  {
    path: 'welcome',
    component: WelcomeComponent,
    loadChildren: () => import('./pages/welcome/welcome.module').then(m => m.WelcomeModule),
    canActivate: [LoginGuardGuard],
    canActivateChild: [GrantGuardGuard]
  },
  {path: 'login', loadChildren: () => import('./pages/login/login.module').then(m => m.LoginModule)},
  {
    path: '**',
    component: NotFoundPageComponent
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule {
}
